package res

type Response struct {
	Code int         `json:"code"`
	Data interface{} `json:"data"`
	Msg  string      `json:"msg"`
}

const (
	ERROR   = 7
	SUCCESS = 0
)

func Ok() Response {
	return Response{
		Code: SUCCESS,
		Msg:  "操作成功",
	}
}

func OkWithData(d interface{}) Response {
	return Response{
		Code: SUCCESS,
		Msg:  "操作成功",
		Data: d,
	}
}
